<?php
require 'Controller.php ';
require './admin/Model/CommentModel.php';

class CommentController extends Controller{
	function __Construct(){
		parent::__Construct();
		$this->mod = 'comments';
		$this->model=new CommentModel();
	}
	function listcomments()
	{
		$data =$this->model->getList();
		$this->assign('comments',$data);
		$this->display(); 
	}
	function commentform()
	{
		$this->display(); 
	}

	
	
	function delete()
	{
		$id = $_GET['id'];

		$result = $this->model->delete($id);
		if($result){
			echo '删除成功 <a href="index.php?c=comment&m=listcomments">如果没有跳转，请点这里跳转</a>';
			header("refresh:3;url='index.php?c=comment&m=listcomments'");
		}
		else{
			echo "删除失败！<br/>";
			echo "<a href='index.php?c=comment&m=listcomments'>返回</a>";
		}
	}
}
?>